Skip to main content

GitHub Actions

INTRODUCTION

GitHub Actions helps you automate your software development workflows from within GitHub. You can deploy workflows in the same place where you store code and collaborate on pull requests and issues. In GitHub Actions, a workflow is an automated process that you set up in your GitHub repository. You can build, test, package, release, or deploy any project on GitHub with a workflow. Each workflow is made up of individual actions that run after a specific event (like a pull request) occur. The individual actions are packaged scripts that automate software development tasks.

Setup a workflow

  1. User should have admin access of GitHub repository
  2. Go to repository -> Actions -> New Workflow

img.png

  1. After then , you can choose & configure any template based on your requirement

img_1.png

  1. yml file will be created as above in .github/workflows/example.yml

GITHUB SECRETS

Secrets are encrypted variables that you create in an organization, repository, or repository environment.

  1. Settings -> Secrets and Variables -> Actions -> repository secrets

img_2.png

  1. Use secrets in workflow

img_3.png

  1. Use secrets in spring boot application- We can get these secrets in our code as an environment variables

img_4.png

ENVIRONMENTS

  1. We can create environments like dev, test, prod etc. for setting up the pipeline as- Settings -> Environments -> New Environments

img_5.png

  1. There are protection rules
  2. We can select deployment branches also
  3. There are environment specific secrets , can be created if required

img_6.png